package com.ndp.fb.walle.model.vo.customaudience.param;

import com.ndp.fb.model.business.vo.BaseVoParam;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by elvisxiong on 15/12/9.
 */
@Setter
@Getter
@NoArgsConstructor
public class CustomAudienceTemplateParam extends BaseVoParam {

    //自定义受众模板ID
    private Long customAudienceTempateId;
    //自定义受众类型
    private String audienceType;
    //数据源子类型
    private String importedType;
    //自定义受众名称
    private String audienceName;
    //数据传递类型
    private String deliverType;
    //应用程序编号
    private String appIds;
    //自定义受众内容
    private String content;

    public void setCustomAudienceTemplateParam(String deliverType,String audienceType,String importedType,String content,String appIds){
        this.deliverType = deliverType;
        this.audienceType = audienceType;
        this.importedType = importedType;
        this.content = content;
        this.appIds = appIds;
    }

    public List<Long> getAppIdList(){
        List<Long> appIdList = new ArrayList<>();
        if(this.appIds != null){
            String[] appIdArray = this.appIds.split(",");
            if(appIdArray.length >0){
                for(int i = 0; i< appIdArray.length; i++){
                    appIdList.add(Long.parseLong(appIdArray[i]));
                }
            }
        }
        return appIdList;
    }

}
